import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import NotFound from '../views/NotFound.vue'
import Storage from '../views/Storage.vue'
import SearchPage from '../views/SearchPage.vue'
import Video from '../views/Video.vue'
import HeatPage from '../views/HeatPage.vue'
import UserCenter from '../views/UserCenter.vue'
import VipPage from '../views/VipPage.vue'
import PaySuccess from '../views/PaySuccess.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        component: Home
    },
    {
        path: '/storage/:pk?',
        name: 'storage',
        component: Storage
    },
    {
        path: '/search',
        name: 'search',
        component: SearchPage
    },
    {
        path: '/video/:pk',
        name: 'video',
        component: Video
    },
    {
        path: '/heat',
        name: 'heat',
        component: HeatPage
    },
    {
        path: '/user/:center?',
        name: 'user',
        component: UserCenter
    },
    {
        path: '/vip',
        name: 'vip',
        component: VipPage
    },
    {
        path: '/pay/success',
        name: 'pay-success',
        component: PaySuccess
    },
    // 都匹配失败 404页面
    {
        path: '*',
        name: 'notfound',
        component: NotFound
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
